﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using Entity;

namespace GUI
{
    public partial class ChiTietTinRaoVatForm : Form
    {
        public int MaTinRaoVat{get;set;}

        public ChiTietTinRaoVatForm()
        {
            InitializeComponent();
        }

        private void ChiTietTinRaoVatForm_Load(object sender, EventArgs e)
        {
            TinRaoVat tin = new TinRaoVatBUS().LoadAllById(MaTinRaoVat);

            lblTieuDe.Text = tin.TieuDe;
            this.Text = tin.TieuDe;
            lblNgayKetThuc.Text = tin.NgayKetThuc;
            lblNgayTao.Text = tin.NgayDang;
            lblKhuVuc.Text = (new KhuVucBUS().LoadKhuVucByID((int)tin.MaKhuVuc)).TenKhuVuc;

            lblNhomTin.Text = (new NhomTinBUS().LoadByID((int)tin.MaNhom)).TenNhomTin;

            lblNoiDung.Text = tin.NoiDung;
            lblNguoiTao.Text = (new NguoiDungBUS().LoadByID((int)tin.NguoiTao)).TenDangNhap;

        }

        private void btnAbuse_Click(object sender, EventArgs e)
        {
           
                int result = new TinRaoVatBUS().ReportAbuse(MaTinRaoVat);
                if (result > 0)
                {
                    MessageBox.Show("Đã report.");
                }
                else {
                    MessageBox.Show("Không thể report.");
                }
            
        }
    }
}
